package hu;

import java.util.*;

public class hu2_721 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        Stack<String> stack = new Stack<>();
        for (int i = 0; i < str.length(); i++) {
//            System.out.println(stack);
            if(str.charAt(i) == '+' || str.charAt(i) == '-' || str.charAt(i) == '('){
                stack.push(str.charAt(i) + "");
                continue;
            }
            if(str.charAt(i) == ')'){
              int c = Integer.parseInt(stack.pop());
              stack.pop();
              while(!stack.isEmpty() && (stack.peek().equals("+") || stack.peek().equals("-"))){
                  String s = stack.pop();
                  String s1 = stack.pop();
                  if(s.equals("-")) {
                      c = Integer.parseInt(s1) - c;
                  }
                  else {
                      c = Integer.parseInt(s1) + c;
                  }
                }
              stack.push(c + "");
              continue;
            }
            int t = i;
            while( i <  str.length() && str.charAt(i) <= '9' && str.charAt(i) >= '0'){
                i++;
            }
            int n = Integer.parseInt(str.substring(t, i));
            i--;
            while(!stack.isEmpty() && (stack.peek().equals("+") || stack.peek().equals("-"))){
                String s = stack.pop();
                String s1 = stack.pop();
                if(s.equals("-")) {
                    n = Integer.parseInt(s1) - n;
                }
                else {
                    n = Integer.parseInt(s1) + n;
                }
            }
            stack.push(n + "");
        }
        System.out.println(stack.pop());
    }
}
/*
2+3-(5+2)=-2

45+(822-359+926)+590+(630+770+844+(444+(936+(942-283-587))))=5720

2+3-(5+2)-(1-2)=-1
 */